window Exception Handler
fun windowExceptionHandler(handler: WindowExceptionHandler): ProvidedValue<WindowExceptionHandlerFactory>
fun windowExceptionHandler(handler: WindowExceptionHandler): ProvidedValue<WindowExceptionHandlerFactory>
Provides a window exception handler for LocalWindowExceptionHandlerFactory composition variable.
Usage example:
CompositionLocalProvider(
windowExceptionHandler { throwable, _ -> throwable.printStackTrace() }
) {
// All uncaught exceptions will be printed to `std.out`.
}
Content copied to clipboard
Please note, the passed WindowExceptionHandler is NOT global. It will be used only within the composition it was provided for AND within a window. As for now, it is impossible to handle uncaught exceptions globally. If your application doesn't have a window (tray-only app), then this handler will not be called. See issue in Compose.
Since
8.0.0